# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=ipmiutil
pkgver=3.1.9
pkgrel=1
pkgdesc="IPMI Management Utilities"
url="https://ipmiutil.sourceforge.net/"
arch="all"
options="!check"  # No test suite shipped.
license="BSD-2-Clause BSD-3-Clause GPL-2.0-or-later"
depends_dev="openssl-dev>3"
makedepends="$depends_dev linux-headers autoconf"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver-u.tar.gz::https://downloads.sourceforge.net/project/ipmiutil/ipmiutil-$pkgver.tar.gz
	ipmiutil-3.0.7-fix-sha256.patch
	"

prepare() {
	default_prepare
	update_config_guess
	chmod +x "$builddir"/install-sh
}

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--libdir=/usr/lib \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-systemd \
		--enable-sha256 \
		--enable-gpl
	make -j1
}

package() {
	make DESTDIR="$pkgdir" install

	# remove systemd service files
	rm -f "$pkgdir/usr/share/ipmiutil/"*.service

	# Remove static library
	rm -f "$pkgdir"/usr/lib/*.a
}

sha512sums="
cda8cf396a5886b9e2cfee8a8f369dc3762e3053fe92aceb430bd8b896c0723eaa85177ff6d555664fbee6ea5899d474d4c074f99a8f2f69d2b4500077db8900  ipmiutil-3.1.9-u.tar.gz
74e8951bccd004f765b99de87dc5f04834e594b3e14ba885148fb971eaf15164ccac2de880e409f201a38cba5c0948a0fabc04e1e34fb396f50b1ecddb6b305b  ipmiutil-3.0.7-fix-sha256.patch
"
